package com.trkj;

import com.trkj.config.Order;
import com.trkj.config.Student;
import com.trkj.dao.EmpDao;
import com.trkj.entity.Emp;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class zy {
    @Test
    public void zy1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("zy1.xml");
        Order order = (Order) context.getBean("order");
        order.cldd();
        order.faHuo();
    }
    @Test
    public void zy2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationConext.xml");
        EmpDao empDao= (EmpDao) context.getBean(EmpDao.class);
        Emp e= (Emp) context.getBean(Emp.class);
        empDao.addEmp(e);
    }
    @Test
    public void zy3(){
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(Student.class);
        context.refresh();

        Student student = context.getBean(Student.class);
        student.xx();
        student.xiux();

        context.close();
    }
}
